var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
// function add(x: number, y: number) : number{
function add(x, y) {
    return x + y;
}
// const add1: IAdd = (
var add1 = function (x, y) {
    return x + y;
};
var add2 = function (x, y) {
    var args = [];
    for (var _i = 2; _i < arguments.length; _i++) {
        args[_i - 2] = arguments[_i];
    }
    return x + y + args.reduce(function (a, b) { return a + b; }, 0);
};
var add3 = function (x, y) {
    return x + y;
};
var num1 = 12;
function join(str) {
    if (Array.isArray(str)) {
        return str.join(",");
    }
    if (typeof str === "string") {
        return str;
    }
    return "";
}
var Animal = /** @class */ (function () {
    function Animal(name) {
        this.name = name;
    }
    Animal.prototype.move = function () {
        console.log(this.name + " is moving");
    };
    return Animal;
}());
var Bird = /** @class */ (function (_super) {
    __extends(Bird, _super);
    function Bird(name) {
        return _super.call(this, name) || this;
    }
    Bird.prototype.fly = function () {
        console.log(this.name + " is flying");
    };
    return Bird;
}(Animal));
var Fish = /** @class */ (function (_super) {
    __extends(Fish, _super);
    function Fish(name) {
        return _super.call(this, name) || this;
    }
    Fish.prototype.swim = function () {
        console.log(this.name + " is swimming");
    };
    return Fish;
}(Animal));
var Dog = /** @class */ (function (_super) {
    __extends(Dog, _super);
    function Dog(name) {
        return _super.call(this, name) || this;
    }
    Dog.prototype.bark = function () {
        console.log(this.name + " is barking");
    };
    return Dog;
}(Animal));
var animal = new Bird("bird");
var animal1 = new Fish("fish");
// const isBird = (animal: IAnimal): animal is Bird => {
var isBird = function (animal) {
    if (animal instanceof Bird) {
        return "is Bird";
    }
    else if (animal instanceof Fish) {
        return "is Fish";
    }
    else if (animal instanceof Dog) {
        return "is Dog";
    }
    else {
        return "is not Bird or Fish";
    }
    // return (animal as Bird).fly !== undefined;
    // return animal instanceof Bird;
};
console.log(isBird(animal1));
